package cn.rkylin.oms.common.collection;

import cn.rkylin.oms.common.function.Function;

import java.util.ArrayList;
import java.util.List;

public final class Arrays {

    public static <T, R> List<R> transform(T[] array, Function<T, R> converter) {
        List<R> converted = new ArrayList<>(array.length);
        for (T item : array) {
            converted.add(converter.apply(item));
        }

        //noinspection unchecked
        return converted;
    }

}
